/**
 * Created by minigci.he on 16/9/22.
 */
console.log('----------------------')
console.log('test2')

class RangeIterator{
    constructor(start, stop){
        this.value = start;
        this.stop = stop;
    }
    [Symbol.iterator](){
        console.log('1111')
        return this;
    }
    next(){
        var value = this.value;
        if(value < this.stop){
            this.value++;
            return {
                done: false,
                value: value
            }
        }else{
            return{
                done: true,
                value: undefined
            }
        }
    }
}

function range(start, stop){
    return new RangeIterator(start, stop)
}

for(let value of range(0, 3)){
    console.log(value)
}
// 0
// 1
// 2